package com.mycode.chainOfResponsibility14.resolve;

// 董事长类：具体处理者
public class President extends Approver {

    public President(String name) {
        super(name);
    }

    @Override
    public void processRequest(PurchaseRequest request) {
        // 处理请求
        if (request.getAmount() < 500000) {
            System.out.println(String.format("董事长：%s 审批采购单：%s 金额：%s 元，采购目的：%s", this.name, request.getNumber(), request.getAmount(), request.getPurpose()));
        }else {
            // 转发请求
            this.successor.processRequest(request);
        }
    }
}
